#!/bin/bash
# Run perf-bench syscall benchmark

###SHELLPACK preamble perfsyscall-bench 5.9
PERFSYSCALL_LOOPS=500000
PERFSYSCALL_ITERATIONS=30

###SHELLPACK parseargBegin
###SHELLPACK parseargInstall
###SHELLPACK parseargBindings
###SHELLPACK parseargParam   --loops       PERFSYSCALL_LOOPS
###SHELLPACK parseargParam   --iterations  PERFSYSCALL_ITERATIONS
###SHELLPACK parseargEnd
###SHELLPACK monitor_hooks

###SHELLPACK check_external_install_required perfbuild perfbuild-${VERSION} ${VERSION}
###SHELLPACK init_complete

PERF_DIR=$SHELLPACK_SOURCES/perfbuild-${VERSION}-installed/bin
PERF_CMD=${PERF_DIR}/perf

echo Perf invocation: $TASKSET_SERVER $PERF_CMD bench syscall basic -l $PERFSYSCALL_LOOPS
monitor_pre_hook $LOGDIR_RESULTS $P
###SHELLPACK iteration_begin $PERFSYSCALL_ITERATIONS
	$TASKSET_SERVER $PERF_CMD bench syscall basic -l $PERFSYSCALL_LOOPS \
			2>&1 | tee $LOGDIR_RESULTS/syscall-${ITERATION}.log
###SHELLPACK iteration_end
monitor_post_hook $LOGDIR_RESULTS $P

exit $SHELLPACK_SUCCESS
